Skip to content

Conversation

@mavilov
Copy link
Contributor

@mavilov mavilov commented Nov 22, 2025

As discussed with @sebtiem we decided to skip the build-cache-extension execution when the single clean goal is called.
We wrote integration tests to verify that it is only skipped when the single clean goal is called.

Following this checklist to help us incorporate your
contribution quickly and easily:

  • Your pull request should address just one issue, without pulling in other changes.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Each commit in the pull request should have a meaningful subject line and body.
    Note that commits might be squashed by a maintainer on merge.
  • Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied.
    This may not always be possible but is a best-practice.
  • Run mvn verify to make sure basic checks pass.
    A more thorough check will be performed on your pull request automatically.
  • You have run the integration tests successfully (mvn -Prun-its verify).

If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

@sparsick
Copy link

created during hack.commit.push event

@elharo elharo requested a review from olamy December 1, 2025 13:09
*/
private boolean isGoalClean(List<MojoExecution> mojoExecutions) {
if (mojoExecutions.stream().allMatch(mojoExecution -> "clean".equals(mojoExecution.getLifecyclePhase()))) {
LOGGER.warn("Build cache is disabled for 'clean' goal.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe info or debug level? Is a warning really needed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elharo your comment makes total sense: info is perhaps better as this will give the user clear overview of what is going on with the cache during the build.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will also prefer info instead of debug if warn is not okay.. IMHO, the user has to be informed that we skip the cache mechanism here because of the clean goal.

* Cache configuration could demand to restore some files in the project
* directory (generated sources or even arbitrary content)
* If an error occurs during or after this kind of restoration AND a clean phase
* was required in the build :
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

: - ,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point: I fixed the formatting of JavaDoc around that symbol, too.

// cacheCandidate.getMojoDescriptor().getFullGoalName())));
// org.apache.maven.api.plugin.Log.class,
// new DefaultLog(LoggerFactory.getLogger(
// cacheCandidate.getMojoDescriptor().getFullGoalName())));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just delete the commented code

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleted

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the commented code has a comment that it is related to mvn4. Therefore, we don't delete it. Is it okay, @sebtiem, if we delete the commented code? (git blame give me your name).

@mavilov
Copy link
Contributor Author

mavilov commented Dec 1, 2025

@elharo thank you for the review. I assume you follow the policy to clean up the code around specific changes related to a specific feature? It's a good practice, I wasn't aware that you guys follow it. Thanks for pointing out.

@elharo elharo requested a review from sparsick December 1, 2025 16:17
@mavilov
Copy link
Contributor Author

mavilov commented Dec 1, 2025

@sparsick hey Sandra, I applied spotless (too late) - please re-run the pipeline when you have a chance. Thanks!

@olamy olamy added the enhancement New feature or request label Dec 2, 2025
Copy link
Member

@olamy olamy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@sparsick sparsick merged commit 90ade09 into apache:master Dec 2, 2025
22 checks passed
@github-actions
Copy link

github-actions bot commented Dec 2, 2025

@sparsick The PR can't be associated to a milestone, because there are multiple open milestones. Please add the text "branch: master" to the description to the milestone where this PR belongs to.

@sparsick sparsick added this to the 1.2.2 milestone Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants